﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Pampa.MVC.Breadcrum
{
    public class BreadcrumAttribute : ActionFilterAttribute
    {
        public string Id { get; set; }
        public string Description { get; set; }

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var id = this.Id ?? filterContext.ActionDescriptor.ActionName;
            var url = filterContext.RequestContext.HttpContext.Request.Url.ToString();

            BreadcrumHelper.SetCurrentNode(id, this.Description, url);

            base.OnActionExecuting(filterContext);
        }
    }
}